package com.lzg.quest.mapper;


import com.lzg.quest.pojo.QuesCommInfoDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.Date;

/**
 * ex_liuzhigao
 * @Date: 2020/6/29 0026
 */

@Repository
public interface IQuesCommInfoDao {

    @Select("SELECT * FROM quescomminfo WHERE comm6 = #{comm6}")
    ArrayList<QuesCommInfoDTO> queryQuesCommInfo(String comm6) throws Exception;

    //问卷页面信息收集
    @Insert("insert into quesCommInfo\n" +
            "  (logeNameCN,logeNameEN,trade,linkman,phone,brief,mean,imgFlag,imgFlagASK,imgFlagCol,imgFlagColASK,wantType,img1,img2,img3,imgNameCN,comm1,comm2,comm3,comm4,comm5,comm6,createtime)\n" +
            "  values\n" +
            "  (#{logeNameCN},#{logeNameEN},#{trade},#{linkman},#{phone},#{brief},#{mean},#{imgFlag},#{imgFlagASK},#{imgFlagCol},#{imgFlagColASK},#{wantType},#{img1},#{img2},#{img3},#{imgNameCN},#{comm1},#{comm2},#{comm3},#{comm4},#{comm5},#{comm6},#{createtime})")
    int insertQuesCommInfo(QuesCommInfoDTO quesCommInfoDTO) throws Exception;

    @Select("select * from quesCommInfo where id = #{id}")
    QuesCommInfoDTO queryQuesDetilById(Integer id) throws Exception;

    @Select("select * from quesCommInfo t where t.createtime >= #{date1} and t.createtime <= #{date2} and t.comm6 = #{comm6}")
    ArrayList<QuesCommInfoDTO> queryQuesCommInfoByDate(Date date1, Date date2,String comm6);
}
